package map;

import java.util.HashMap;
import java.util.Map;

public class MapDemo2 {
    public static void main(String[] args) {
        Map<String,Integer>map = new HashMap<>();
        map.put("语文",60);
        map.put("数学",99);
        map.put("英语",65);
        map.put("物理",98);
        map.put("化学",97);
        System.out.println(map);
        Integer value = map.get("语文");
        System.out.println(value);
        value = map.get("体育");
        System.out.println(value);
        System.out.println("map的大小是:"+map.size());
        System.out.println("map是否为空集:"+map.isEmpty());
        System.out.println(map);

        System.out.println("是否包含数学这个键"+map.containsKey("数学"));
        System.out.println("是否包含99这个值"+map.containsValue(99));

        map.remove("语文");
        System.out.println(map);
        value = map.remove("英语");
        System.out.println(value);
        System.out.println(map);

        map.clear();
        System.out.println(map);
    }
}
